// pages/userStatistics/UserDeatils/vipCardList.js
const controller=require("../../controllers/Controller").controller

Page({

  /**
   * 页面的初始数据
   */
  data: {
    accountId:"",
    cardList:[],
    src1:"https://xinlingshoushangquan.oss-cn-shenzhen.aliyuncs.com/account/20210915/887756367236956160.png",
    src2:"https://xinlingshoushangquan.oss-cn-shenzhen.aliyuncs.com/account/20210915/887756346697449472.png",
    src3:"https://xinlingshoushangquan.oss-cn-shenzhen.aliyuncs.com/account/20211030/904011120447062016.png"
  },


  //获取会员卡列表
  getVipCardList(){
    let value={}
    value.shopId=wx.getStorageSync('shopId')
    value.accountId=this.data.accountId
    controller.checkLookVIPlist(value).then(res=>{
      this.setData({
        cardList:res.data
      })
    })
  },

  //跳转会员卡详情
  toVipCardDetail(e){
    let index=e.currentTarget.dataset.index
    wx.navigateTo({
      url: '/pages/userStatistics/UserDeatils/vipCardDetail?id='+this.data.cardList[index].accountVipId+"&isRead=1",
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      accountId:options.accountId
    })
    this.getVipCardList()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})